﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;
using System.Data.SqlClient;
using System.Collections.Generic;

public partial class lb_shenpi_updatepost : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ddl_bumen_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.ddl_bumen.Text != "选择部门")
        {
            int id = Int32.Parse(this.ddl_bumen.Text);
            SqlParameter bumen = new SqlParameter("@dept_id", id);
            IList<lbEmploy> list = BLLGeneric.Select<lbEmploy>(CommandType.StoredProcedure, "lb_liandong", bumen);
            //配置数据源
            this.ddl_em.DataSource = list;
            //绑定字段属性
            this.ddl_em.DataTextField = "Em_name";
            this.ddl_em.DataValueField = "Em_name";
            //绑定控件
            this.ddl_em.DataBind();
        }
        else
        {
            this.Response.Write(string.Format(GetRedirect.WINALERT, "请选择部门"));
            this.ddl_bumen.Focus();
            return;
        }
    }
    protected void btnclean_Click(object sender, EventArgs e)
    {
        this.txbnames.Text = "";
    }
    protected void btnadd_Click(object sender, EventArgs e)
    {
        this.txbnames.Text += this.ddl_em.Text + ",";
    }
    protected void btndj_Click(object sender, EventArgs e)
    {
        string str = this.txbnames.Text.Trim();
        string[] snames = str.Split(',');
        foreach (string s in snames)
        {
            if (s == "")
            {
                break;
            }
            SqlParameter parm = new SqlParameter("@name", s);
            IList<users> user = BLLGeneric.Select<users>(CommandType.StoredProcedure, "lb_employ", parm);
            users u = user[0];
            examine ex = (examine)Session["examines"];
            //接收人的ID
            ex.ex_inceptid = u.u_id;
            examineBLL.Update(ex);
        }
        this.Response.Write(string.Format(GetRedirect.WINALERT, "递交申请成功!"));
        this.Response.Write(string.Format(GetRedirect.REDIRECT,"splist.aspx"));
    }
}
